#{extends 'main.html' /}
#{set title:'Home' /}

<div id="content">

<div class="bloque_centro">
#{ifnot post?.id}
	<h3>Write a new post</h3>
#{/ifnot}
#{else}
	<h3>Edit the post</h3>
#{/else}


#{ifErrors}
<p class="error">
Please correct these errors.
</p>
#{/ifErrors}

#{form @PostController.save(), method:'POST', id:'postForm'}
#{field 'post.id'}
  <input type="hidden" id="${field.id}" name="${field.name}" value="${post?.id}" class="${field.errorClass}">
#{/}
#{field 'post.title'}
<p>
  <label for="${field.id}">&{field.name}</label>
  <input type="text" id="${field.id}" name="${field.name}" value="${post?.title}" class="${field.errorClass}">
  <span class="error">${field.error}</span>
</p>
#{/}
#{field 'post.content'}
<p>
  <label for="${field.id}">&{field.name}</label>
  <input type="text" id="${field.id}" name="${field.name}" value="${post?.content}" class="${field.errorClass}">
  <span class="error">${field.error}</span>
</p>
#{/}
<input type="submit"></input>
#{/form}
</div>

</div>